using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using rambla.raws.rats;
using System.IO;

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e)
    {
        ratsConnection conn = new ratsConnection("UID", "PWD");
        Format fmr = conn.formatProfiles.getItem("197");
        string Filename = Guid.NewGuid().ToString().Replace("-", "") + ".mpg";
        conn.scrFiles.createItem("c:\\my_file.mpg", Filename);

        Job newJob = new Job
        {
            format = fmr.id,
            src_location = Filename
        };

        conn.jobs.createItem(newJob);

        foreach (transcFile file in conn.transcFiles.items)
        {
          File.WriteAllBytes("c:\\"+ file.filename,conn.transcFiles.downloadItem(file.filename));
        }
    }
}
